package com.doit.demo03;

import java.util.concurrent.Callable;

public class Mysum implements Callable<Integer> {
private  int n ;
public Mysum(int n){
    this.n=n;
}
    @Override
    public Integer call() throws Exception {
        int sum = 0;
        for (int i = 0; i <= n; i++) {
            sum+=i;
        }
        System.out.print(Thread.currentThread().getName()+"  ");
        return sum;
    }
}
